SUBROUTINE dprodfunc(imunin,ieduin,zzpuin,zzprin,dqdpuout)
  USE commonvars
  IMPLICIT NONE
  INCLUDE 'mpif.h'

  REAL(8), INTENT(IN)  :: zzpuin, zzprin
  INTEGER, INTENT(IN)  :: imunin, ieduin
  REAL(8), INTENT(OUT) :: dqdpuout

  !ability_g is a continuos variable drawn from a normal distribution
  !this variable is set in mayordecision, mayorsolution, or mayorsolution0

  dqdpuout = alphaq(1)*(zzpuin*norm)**(alphaq(1)-1d0)*zzprin**alphaq(2)*EXP(alphaq(3)*DBLE(ieduin)+alphaq(4)+polypop(imunin))*ability_g*norm/popsizeg

END SUBROUTINE dprodfunc
